package com.ld.service.impl;

import com.ld.basic.service.impl.BaseServiceImpl;
import com.ld.doamin.Role;
import com.ld.dto.RoleDTO;
import com.ld.mapper.RoleMapper;
import com.ld.service.IRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class RoleServiceImpl extends BaseServiceImpl<Role> implements IRoleService {

    @Autowired
    private RoleMapper mapper;



    @Override
    @Transactional
    public void putDto(RoleDTO dto) {
        //再保存之前如果已经有了该权限，就要删除，所以先删除再保存
        mapper.deleteDto(dto.getRoleId());
        mapper.saveDto(dto);
    }

    @Override
    public List<String> getSns(Long roleId) {
        return mapper.getSns(roleId);
    }
}
